<?php
Configure::load("emoticons");

class EmoticonsHelper extends AppHelper {
    public function emoticonize($text) {
        $burl = Configure::read("Emoticons.url");
        foreach(Configure::read("Emoticons.emoticons") as $k => $img) {
            $text = str_ireplace($k, '<img src="'.$burl.$img.'", alt="'.$k.'" title="'.$k.'" />', $text);
        }

        return $text;
    }
}

?>
